package com.memo4android.model;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.GridView;

import com.memo4android.ui.TodoListButton;
import com.memo4android.ui.TodoListClickedListener;
import com.memo4android.ui.TodoListLongClickListener;

public class FaibleAdapter extends BaseAdapter {

	private Context mContext;
	private AppModel model;

    public FaibleAdapter(Context c) {
    	mContext = c;
        model = AppModel.getInstance(c);
    }


	public int getCount() {
		return 	model.getNumberOfTodoListFaible();
	}

	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		
		
			ItemTodoList Tdl = model.getTodoListFaible(position);
			TodoListButton todoListButton = new TodoListButton(mContext, Tdl);
			todoListButton.setOnClickListener(new TodoListClickedListener(mContext, Tdl));
			todoListButton.setOnLongClickListener(new TodoListLongClickListener(mContext, Tdl));
			todoListButton.setLayoutParams(new GridView.LayoutParams(LayoutParams.FILL_PARENT, 70));
			return todoListButton;			
		
			
	}
			
		
}
